package com.sand.controller;

import com.sand.dto.supplier.LogisticsSelect;
import com.sand.dto.supplier.MerchantS;
import com.sand.dto.supplier.SupplierF;
import com.sand.entity.sell.Logistics;
import com.sand.result.ResponseResult;
import com.sand.service.LogisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/logistics")
public class LogisticsController {

    @Autowired
    private LogisticsService logisticsService;

    /**
     * 条件查看物流
     */
    @PostMapping("/all")
    private ResponseResult<List<Logistics>> all (@RequestBody LogisticsSelect logisticsSelect){
        List<Logistics> list = logisticsService.all(logisticsSelect);
        return new ResponseResult<List<Logistics>>().ok(list);
    }


    /**
     * 物流到达
     */
    @PostMapping("/daoda")
    private ResponseResult<Integer> daoda(@RequestBody Integer logisticsid){
        Integer i = logisticsService.daoda(logisticsid);
        return new ResponseResult<Integer>().ok(i);
    }



    /**
     * 卖家发货
     */
    @PostMapping("/fa")
    public ResponseResult<Integer> fa(@RequestBody SupplierF supplierF){
        Integer i = logisticsService.fa(supplierF);
        return new ResponseResult<Integer>().ok(i);
    }

    /**
     * 卖家收货
     */
    @PostMapping("/shou")
    public ResponseResult<Integer> shou(@RequestBody MerchantS merchantS){
        Integer i = logisticsService.shou(merchantS);
        return new ResponseResult<Integer>().ok(i);
    }


    /**
     * 入仓
     */
    @PostMapping("/enter")
    public ResponseResult<Integer> enter(@RequestBody Integer logisticsid){
        Integer i = logisticsService.enter(logisticsid);
        return new ResponseResult<Integer>().ok(i);
    }



}
